import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class NumberBean implements WritableComparable<NumberBean> {
    private Integer number;

    public NumberBean() {
    }

    public NumberBean(Integer number) {
        this.number = number;
    }

    @Override
    public String toString() {
        return "\t" + getNumber();
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    @Override
    public int compareTo(NumberBean bean) {
        return this.number.compareTo(bean.number);
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(number);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        number = dataInput.readInt();
    }
}
